﻿Public Class FieldModel

    Public Property Name As String
    Public Property FieldValue As String

    ''' <summary>
    ''' Constructor method.
    ''' </summary>
    ''' <param name="name">Field name.</param>
    ''' <param name="value">Default field value.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal name As String, ByVal value As String)
        Me.Name = name
        Me.FieldValue = value
    End Sub

    Public Function DataBaseValue() As String
        If String.IsNullOrEmpty(Me.FieldValue) Then
            Return ""
        Else
            Return Me.FieldValue.Trim(",".ToCharArray).Replace("'", "\'")
        End If
    End Function

    Public Function AssignString() As String
        Return Me.Name + " = '" + Me.DataBaseValue + "'"
    End Function

    Public Function UpdateString() As String
        Return Me.AssignString
    End Function

    Public Function FilterString() As String
        Return Me.AssignString
    End Function

End Class
